#include <chrono>
#include "monitoring.hpp"
#include <string>
#include <iostream>

// Get the current time to measure duration.
long long monitoring::get_time()
{
    // Get the timestamp.
    auto start = std::chrono::high_resolution_clock::now();

    // Convert the timestamp to a long long to be able to insert it into the Trade Event.
    return std::chrono::duration_cast<std::chrono::nanoseconds>(start.time_since_epoch()).count();
}

// Get interval buckets for Prometheus in nanoseconds.
std::vector<double> monitoring::get_buckets()
{
    // Create buckets for the measurements; you can also do it dynamically.
    return {
        100,
        200,
        300,
        400,
        500,
        600,
        700,
        800,
        900,
        1000,
        1500,
        2000,
        2500,
        3000,
        3500,
        4000,
        4500,
        5000,
        5500,
        6000,
        6600,
        7000,
        7500,
        8000,
        8500,
        9000,
        9500,
        10000,
        11000,
        12000,
        13000,
        14000,
        15000,
        16000,
        17000,
        18000,
        19000,
        20000,
        25000,
        30000,
        35000,
        40000,
        45000,
        50000,
        55000,
        60000,
        65000,
        70000,
        75000,
        80000,
        85000,
        90000,
        95000,
        100000,
        101000,
        102000,
        103000,
        104000,
        105000,
        106000,
        107000,
        108000,
        109000,
        110000,
        111000,
        112000,
        113000,
        114000,
        115000,
        116000,
        117000,
        118000,
        119000,
        120000,
        121000,
        122000,
        123000,
        124000,
        125000,
        126000,
        127000,
        128000,
        129000,
        130000,
        131000,
        132000,
        133000,
        134000,
        135000,
        136000,
        137000,
        138000,
        139000,
        140000,
        141000,
        142000,
        143000,
        144000,
        145000,
        146000,
        147000,
        148000,
        149000,
        150000,
        151000,
        152000,
        153000,
        154000,
        155000,
        156000,
        157000,
        158000,
        159000,
        160000,
        161000,
        162000,
        163000,
        164000,
        165000,
        166000,
        167000,
        168000,
        169000,
        170000,
        171000,
        172000,
        173000,
        174000,
        175000,
        176000,
        177000,
        178000,
        179000,
        180000,
        181000,
        182000,
        183000,
        184000,
        185000,
        186000,
        187000,
        188000,
        189000,
        190000,
        191000,
        192000,
        193000,
        194000,
        195000,
        196000,
        197000,
        198000,
        199000,
        200000,
        210000,
        220000,
        230000,
        240000,
        250000,
        260000,
        270000,
        280000,
        290000,
        300000,
        310000,
        320000,
        330000,
        340000,
        350000,
        360000,
        370000,
        380000,
        390000,
        400000,
        410000,
        420000,
        430000,
        440000,
        450000,
        460000,
        470000,
        480000,
        490000,
        500000,
        510000,
        520000,
        530000,
        540000,
        550000,
        560000,
        570000,
        580000,
        590000,
        600000,
        610000,
        620000,
        630000,
        640000,
        650000,
        660000,
        670000,
        680000,
        690000,
        700000,
        710000,
        720000,
        730000,
        740000,
        750000,
        760000,
        770000,
        780000,
        790000,
        800000,
        810000,
        820000,
        830000,
        840000,
        850000,
        860000,
        870000,
        880000,
        890000,
        900000,
        910000,
        920000,
        930000,
        940000,
        950000,
        960000,
        970000,
        980000,
        990000,
        1000000,
        1500000,
        2000000,
        2500000,
        3000000,
        3500000,
        4000000,
        4500000,
        5000000,
        5500000,
        6000000,
        6500000,
        7000000,
        7500000,
        8000000,
        8500000,
        9000000,
        9500000,
        10000000,
        15000000,
        20000000,
        25000000,
        30000000,
        35000000,
        40000000,
        45000000,
        50000000,
        55000000,
        60000000,
        65000000,
        70000000,
        75000000,
        80000000,
        85000000,
        90000000,
        95000000,
        100000000,
        150000000,
        200000000,
        250000000,
        300000000,
        350000000,
        400000000,
        450000000,
        500000000,
        550000000,
        600000000,
        650000000,
        700000000,
        750000000,
        800000000,
        850000000,
        900000000,
        950000000,
        1000000000,
        1500000000,
        2000000000,
        2500000000,
        3000000000,
        3500000000,
        4000000000,
        4500000000,
        5000000000,
    };
}